// initial state
const state = {
  searchFilter: false,
  isLogon: false
}

// getters
const getters = {
  showSearchFilter: state => state.searchFilter,
  isLogon: state => state.isLogon,
  isLogoff: state => !state.isLogon
}

// actions
const actions = {
  toggleSearchFilter: ({ commit }) => commit('toggleSearchFilter'),
  logon: ({commit}) => commit('doLogon'),
  logoff: ({commit}) => commit('doLogoff'),
  loginail: ({commit}) => commit('doLoginFail')
}

// mutations
const mutations = {
  toggleSearchFilter (state) {
    state.searchFilter === false ? state.searchFilter = true : state.searchFilter = false
  },
  doLogon (state) {
    state.isLogon = true
  },
  doLogoff (state) {
    state.isLogon = false
  },
  doLoginFail (state) {
    state.isLogon = false
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
